const app = getApp();

Page({
  data: {
    username:'',
    password:''
  },
  regiSterSubmit: function() {
    wx.request({
      url: 'http://interview-api-t.itheima.net/h5/user/register',
      method: 'POST',
      data: {
        username:this.data.username,
        password:this.data.password
      },
      success: function(res) {
        wx.showToast({
          title: '注册成功',
          icon: 'success',
          duration: 2000,
          success: function() {
            wx.navigateBack();
          },
        });
      },
      fail: function(error) {
        console.error('注册失败:', error);
      },
    });
  },
});
